package com.niuquan.activitie;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.niuquan.adapter.ContactListAdapter;
import com.niuquan.modal.ContactsItem;

/**
 * Created by DELL on 2015/5/23.
 */
public class ContactsFragment extends Fragment {
    ListView contactsListview;
    ContactListAdapter contactListAdapter;
    LinearLayout yaoqinglayout;
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        return inflater.inflate(R.layout.layout_contacts_all, container, false);
    }
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        yaoqinglayout = (LinearLayout)getView().findViewById(R.id.contactsheader);
        contactsListview = (ListView)getView().findViewById(R.id.contactsall_list);
        ContactsItem item = new ContactsItem("hahahaha","1111","/sdcard/img_axset.png","java");
        ExpertCircle.Contactsall.add(item);
        contactListAdapter = new ContactListAdapter(getActivity(),ExpertCircle.Contactsall);
        contactsListview.setAdapter(contactListAdapter);
        yaoqinglayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(getActivity(),InvitedClass.class);
                startActivity(intent);
            }
        });
        contactsListview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent intent = new Intent();
                intent.setClass(getActivity(),niu_info.class);
                startActivity(intent);
            }
        });
    }
}
